<?php

use App\Livewire\CategoryList;
use App\Livewire\IndexPage;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/', IndexPage::class)->name('index');
Route::get('/email', function (){
    $borrow = \App\Models\BorrowRecord::where('returned',2)->first();
    return new \App\Mail\BorrowOvered($borrow);
})->name('email');
Route::prefix('/category')->group(function (){
   Route::get('/list/{category}',CategoryList::class)->name('category.list');
});
Route::get('/search', \App\Livewire\SearchList::class)->name('search');

Route::get('/book/{book}', \App\Livewire\BookPage::class)->name('book');
Route::middleware([
    'auth:sanctum',
    config('jetstream.auth_session'),
    'verified',
])->group(function () {

    Route::get('/dashboard', \App\Livewire\MemberIndex::class)->name('dashboard');
    Route::get('/borrow', \App\Livewire\BorrowList::class)->name('borrow.list');
    Route::get('/order', \App\Livewire\OrderPage::class)->name('order');
    Route::get('/benefit', \App\Livewire\MemberBenefit::class)->name('benefit');
    Route::get('/chapter/{chapter}', \App\Livewire\ChapterPage::class)->name('chapter');
});
